#ifndef IMAGEINSTANCEDATA_H
#define IMAGEINSTANCEDATA_H

#include <QString>
#include <QImage>
#include "dcmtk/dcmimgle/diutils.h"
class DcmFileFormat;
class DicomImage;

class ImageInstance
{
public:
    explicit ImageInstance(const QString &file);
    explicit ImageInstance(DcmFileFormat *dff);
    ~ImageInstance();

    bool getPixelSpacing(double &px, double &py) const { if (dcmff) { px = pixelSpacingX; py = pixelSpacingY; return true; } return false;}
    const ushort *getRawData() const;
    const short *getInterData();
    bool getImageSize(ulong &width, ulong &height) const;
    DcmFileFormat *getFileFormat() const;
    QImage getPixmap();

    QString patientID;
    QString patientName;
    QString patientBirth;
    QString patientSex;
    QString patientAge;

    QString studyUid;
    QString studyTime;
    QString studyDes;
    QString accessionNumber;
    QString procId;
    QString bodyPart;
    QString bodyPos;

    QString seriesUid;
    QString seriesNumber;
    QString seriesDes;
    QString modality;
    QString modelName;
    QString manufacturer;

    QString instanceUid;
    QString sopClassUid;
    QString instanceNumber;
    QString acquisitionTime;
    QString institution;
    QString patientPostion;
    QString reqPhysician;
    QString perPhysician;

    QString filePath;

private:
    void initImage();

    double kvp;
    double mAs;
    double mA;
    double mS;
    double pixelSpacingX;
    double pixelSpacingY;
    double sliceThickness;
    double startX;
    double startY;
    double sliceLocation;
    double intercept;

    double winWidth;
    double winCenter;

    ushort imgWidth;
    ushort imgHeight;

    DcmFileFormat *dcmff;
    DicomImage *dcmImage;
};

#endif // IMAGEINSTANCEDATA_H
